<?php

namespace library;

/**
 * klasa implementująca wzorzec projektowy rejestr
 *
 * @author Damian Jóźwiak
 */
class Registry {
    private static $instances = array();
    private function __construct() {
    }
    private function __clone() {
    }
    public static function get($key,$default=null){
        if (isset(self::$instances[$key])){
            return self::$instances[$key];
        }
        return $default;
    }
    public static function set($key,$instance=null){
        self::$instances[$key]=$instance;
    }
    public static function erase($key){
        unset(self::$instances[$key]);
    }
}
